package com.cpo.controllers;

import java.io.IOException;
import java.rmi.ServerException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
public class LogoutController {

	
	@Autowired
	HttpServletRequest request;
	
	@RequestMapping(value="/logout", method=RequestMethod.GET)
	public void logout(HttpServletResponse response) throws IOException, ServerException
	{
		request.getSession().invalidate();
		response.sendRedirect(request.getContextPath());
	}
}
